import axios, { AxiosRequestConfig } from 'axios'

import type * as TList from '../interface'
import './__mock__'

/** 获取路由模板列表 */
export const apiGetTplRouteList = async (
  req: TList.ITplRouteListReq,
  signal?: AxiosRequestConfig['signal'],
): Promise<TList.ITplRouteListRes> => {
  return axios.post(`/tmsapi/route_template/list`, req, { signal }).then(res => ({
    ...res.$data,
    records: res.$data.records || [],
  }))
}
